﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Abp.Domain.Repositories;
using Abp.Domain.Services;
using Abp.UI;
using FwProject.Core.AppVersion;
using FwProject.ShoppingMall.Com;
using FwProject.ShoppingMall.EventAdvertising;

namespace FwProject.Manager
{
    public class ShopAdManager : IDomainService
    {
        private readonly IRepository<ShopAd, Guid> _shopAdRepository;

        public ShopAdManager(IRepository<ShopAd, Guid> shopAdRepository)
        {
            _shopAdRepository = shopAdRepository;
        }
        /// <summary>
        /// 添加一个广告
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task<Guid> CreateShopAd(ShopAd model)
        {
            return await _shopAdRepository.InsertAndGetIdAsync(model);
        }
        /// <summary>
        /// 修改一个广告
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>

        public async Task UpdateShopAd(ShopAd model)
        {

            await _shopAdRepository.UpdateAsync(model);
        }

        /// <summary>
        /// 删除一个广告
        /// </summary>
        /// <param name="model"></param>
        /// <returns></returns>
        public async Task DeleteShopAd(ShopAd model)
        {
            await _shopAdRepository.DeleteAsync(model);
        }
    }
}
